package demo;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * 城市判断表达式
 * @author ZhouWeiBo
 * @create 2022/6/8
 */
public class CityExpression implements Expression{

    private final Set<City> cities = new HashSet<>();

    public CityExpression(City[] cities) {
        this.cities.addAll(Arrays.asList(cities));
    }

    @Override
    public boolean interpret(Person person) {
        return cities.contains(person.getCity());
    }

}
